import { request } from '../index'


// 点赞

/*
*  @resourceType 被点赞的资源类型 1-短剧 2-剧集
*  @resourceId 被点赞的资源id（短剧id或剧集id）
*  @userId 点赞的用户id (可选)
* @type   1 点赞 2 取消点赞
*/
export const addLike = (params) => {
    return request({
        url: "/user/appLike/add",
        data: params
    })
}


// 取消点赞

export const deleteLike = (params) => {
    return request({
        url: "/user/appLike/cancel",
        data: params
    })
}

// 追剧

/*
 * @ videoId 短剧ID
*/
export const chaseVideo = (params) => {
    return request({
        url: "/user/appChaseVideo/add",
        data: params
    })
}

// 取消追剧

export const cancelChaseVideo = (params) => {
    return request({
        url: "/user/appChaseVideo/cancel",
        data: params
    })
}

// 同步播放历史
/*
* @videoId 短剧Id
* @videoEpisodeId 剧集ID
* @isChase 是否追剧  0 否 1 是
* @playSecond  播放进度 秒值
*/

export const syncPlayHistory = (params) => {
    return request({
        url: "/user/sync_play_history",
        data: params
    })
}



// 推荐页视频

export const getRecommendVideoList = (params) => {
    return request({
        url: "/video/v2/appVideo/recommendVideos",
        data: params
    })
}

// 签发 playAuthToken

export const getVideoUrl = (params) => {
    return request({
        url: "/video/volcengine/queryPlayAuthToken",
        data: params
    })
}

// 查询短剧下的所有集
/*
    *@pageNum integer <int32>当前页数 必需
    *@pageSize integer <int32>分页大小 可选 
    *@videoId integer <int64>短剧id 必需
    *@episodeNo integer <int32>可选

*/

export const getVideoEpisodeList = (params) => {
    return request({
        url: "/video/appVideo/episodeList",
        data: params
    })
}

// 查询短剧的广告模板及充值模板信息

export const getRechargeTemplate = (params) =>{
    return request({
        url:"/video/appVideo/adAndRechargeTemplateInfo",
        data:params
    })
}

// M币解锁剧集

export const unlockEpisode = (params) =>{
    return request({
        url:"/user/unlock_video_episode",
        data:params
    })
} 